Declarative Object Identity Using Relation Types
نویسندگان
چکیده
Object-oriented languages define the identity of an object to be an address-based object identifier. The programmer may customize the notion of object identity by overriding the equals() and hashCode() methods following a specified contract. This customization often introduces latent errors, since the contract is unenforced and at times impossible to satisfy, and its implementation requires tedious and error-prone boilerplate code. Relation types are a programming model in which object identity is defined declaratively, obviating the need for equals() and hashCode() methods. This entails a stricter contract: identity never changes during an execution. We formalize the model as an adaptation of Featherweight Java, and implement it by extending Java with relation types. Experiments on a set of Java programs show that the majority of classes that override equals() can be refactored into relation types, and that most of the remainder are buggy or fragile.
منابع مشابه
Declarative Semantics in Object-Oriented Software Development - A Taxonomy and Survey
One of the modern paradigms to develop an application is object oriented analysis and design. In this paradigm, there are several objects and each object plays some specific roles in applications. In an application, we must distinguish between procedural semantics and declarative semantics for their implementation in a specific programming language. For the procedural semantics, we can write a ...
متن کاملComprehension of Complex Sentences in the Persian-Speaking Patients With Aphasia
Introduction: To study sentence comprehension in Persian-speaking Patients with Aphasia considering the factors of complexity. Methods: In this cross-sectional study, the performance of 6 non-fluent aphasic patients were tested and their performance was compared to 15 matched control group. Comprehension of semantically reversible sentences was assessed using a binary sentence-picture matching...
متن کاملSword: a Declarative Object-oriented Database Architecture
We present a language Noodle in which to specify declarative queries in an object-oriented database system. The language models object-identity, classes, relations, views, inheritance, complex objects, and methods, in addition to logical rules. Noodle is intended to be used as a query language in an object-oriented database system, with the beneets of declarativeness, namely increased eeciency ...
متن کاملThe role of mediation of mind-consciousness components in relation between different types of goal orientations with four-personality identities.
Introduction: The formation of identity is one of the important issues in the field of education, which is subtly related to cognitive and motivational processes; therefore, this study aimed to investigate the mediating role of mindfulness in the relationship between goal orientations with educational identity. Methods: The research method was descriptive-correlational and its statistical popul...
متن کاملConstraints and Object Identity
Constraint imperative programming is an integration of declarative constraints and imperative object-oriented programming. The primary goal of this integration is to use constraints to express relations among objects explicitly— relations that were implicit in the code in previous languages. However, one of the fundamental concepts of object-oriented programming, object identity, can result in ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2007